package com.mentormobile.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.EditText;
import android.widget.Spinner;

public class Mlib {
	
	public static boolean IsEmpty(Object obj){
		
		if(obj instanceof EditText)
		{
			String txt = ((EditText)obj).getText().toString();
			if(txt.equals("") || txt == null ){
				return true;
			}
		}
		if(obj instanceof Spinner)
		{
			Spinner spi = (Spinner)obj;
			Object ob =  spi.getSelectedItem();
			String string = ob.toString();
			if(string == null || string == "" )
				return true;
		
		}
		
		return false;
	}
	
	public static void AlertMessage(Context con,String txt){
		AlertDialog.Builder dialog = new AlertDialog.Builder(con);
		dialog.setMessage(txt);
		dialog.setNeutralButton("OK",new DialogInterface.OnClickListener() {
			
			public void onClick(DialogInterface dialog, int which) {
				
				
			}
		});
		
		dialog.setTitle("Aviso");
		dialog.show();
	}
}
